<template>
  <d2-container>
    <el-form ref="form" :model="formData" label-width="160px" style="width:800px;margin-top:40px">
      <el-form-item label="APP服务号UID：" prop="app_uid">
        <el-input type="number" :min="1" v-model="formData.app_uid" placeholder="请输入APP服务号UID" />
      </el-form-item>
      <el-form-item label="APP名称：" prop="app_name">
        <el-input v-model="formData.app_name" placeholder="请输入APP名称" />
      </el-form-item>
      <el-form-item label="用户收入ID：" prop="payinid">
        <el-input type="number" :min="1" v-model="formData.payinid" placeholder="请输入用户收入ID" />
      </el-form-item>
      <el-form-item label="金币名称：" prop="gold_unit">
        <el-input v-model="formData.gold_unit" placeholder="请输入金币名称" />
      </el-form-item>
      <!-- <el-form-item label="APP下载短链接：" prop="app_url">
        <el-input v-model="formData.app_url" placeholder="支持多填写，之间用英文逗号(,)隔开，用户端每次随机取一个" />
      </el-form-item> -->
      <!-- <el-form-item label="口令使用提示文案：" prop="code_text">
        <el-input v-model="formData.code_text" placeholder="请输入口令使用提示文案" />
      </el-form-item> -->
      <el-form-item label="技术支持：" prop="bottom_text">
        <el-input v-model="formData.bottom_text" placeholder="例如：西蜀网技术支持" />
      </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">保存</el-button>
    </el-form-item>
    </el-form>
  </d2-container>
</template>

<script>
import { crudOptions } from './crud' // 上文的crudOptions配置
import { d2CrudPlus } from '@/components/d2-crud-plus'
import { GetList, editObj } from '@/api/classify' // 查询添加修改删除的http请求接口
export default {
  name: 'classify',
  mixins: [d2CrudPlus.crud], // 最核心部分，继承d2CrudPlus.crud
  data () {
    return {
      tableData: [],
      formData: {
        app_uid: '',
        payinid: '',
        app_name: '',
        // app_url: '',
        // code_text: '',
        gold_unit: '',
        bottom_text: ''
      }
    }
  },
  methods: {
    getCrudOptions () {
      return crudOptions
    },
    doRefresh () {
      this._getTableData()
    }, // 数据请求
    _getTableData () {
      GetList().then(res => {
        this.formData = res
      }).finally(() => {
        this.tableLoading = false
      })
    },
    onSubmit () {
      const { formData } = this
      editObj({ ...formData }).then(res => {
        this._getTableData()
      }).finally(() => {
        this.submitLoading = false
      })
    }
  }
}
</script>
<style>
.el-input {
    margin-right: 10px;
    position: relative;
    font-size: 14px;
    display: inline-block;
    width: 100% !important;
}
</style>
